//
// Copyright (c) 2024 BPer
//
#ifndef __BPerVideoBuffer__
#define __BPerVideoBuffer__

#include <bperutil/buffer/BPerMediaBuffer.h>


#define bPer_get_videoBuffer(x) new BPerVideoBuffer(x->width,x->height,x->videoCaptureFormat==BPerYuy2?16:12,x->bitDepth==8?1:2)
class BPerVideoBuffer:public BPerMediaBuffer
{
public:
	BPerVideoBuffer(int32_t pBitDepthLen);

	BPerVideoBuffer(int32_t pwid,int32_t phei,BPerYuvType ptype,int32_t pBitDepthLen);
	~BPerVideoBuffer(void);
	void initTemp();
	void init(int32_t pwid,int32_t phei,BPerYuvType ptype);


	void reset();
	int32_t isPreview=0;
	int32_t m_width;
	int32_t m_height;
	int32_t m_length;
	int32_t m_frames;
	int32_t m_bitDepthLen;
	void putVideo(BPerFrame* pframe);

	void getVideo(BPerFrame* pframe);
	uint8_t * getVideoRef(BPerFrame* pframe);
	int64_t getTimestamp(int64_t *timestamp);
	int64_t getNextTimestamp();
	BPerFrame* getCurVideoFrame();

protected:


private:
	int32_t m_headerLen;


};
#endif
